package com.ss.test06;

/**
 * @Auther: 520ljs
 * @Date: 2022/3/19 - 03 - 19 - 22:59
 */
public class TestThread01 extends Thread {
    @Override
    public void run() {
        for (int i = 1; i <= 10; i++){
            System.out.println(i);
        }
    }
}

class TestThread02 extends Thread{
    @Override
    public void run() {
        for (int i = 20; i <= 30; i++){
            System.out.println(i);
        }
    }
}

class Test{
    //这是一个main方法，是程序的入口
    public static void main(String[] args) {
        //创建两个子线程，让这两个子线程抢夺资源：
        TestThread01 t1 = new TestThread01();
        t1.setPriority(10);//优先级别高
        t1.start();

        TestThread02 t2 = new TestThread02();
        t2.setPriority(1);
        t2.start();
    }
}
